package com.ld.campus_help.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ld.campus_help.entity.Notice;
import com.ld.campus_help.service.NoticeService;
import com.ld.campus_help.util.Result;
import com.ld.campus_help.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    @GetMapping("/noticeList")
    public Result getNotice(){
        QueryWrapper<Notice> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("school_id", 1);
        Notice result = noticeService.getOne(queryWrapper);
        if(result != null) return ResultUtil.success(result);
        return ResultUtil.failure();
    }
}
